#version 410

layout (lines) in;
layout (line_strip, max_vertices = 5) out;

void main()
{
	vec2 pos2 = gl_in[0].gl_Position.xy;
	vec2 pos3 = gl_in[1].gl_Position.xy;
	vec2 pos1 = vec2(pos2.x,pos3.y);
	vec2 pos4 = vec2(pos3.x, pos2.y);

    gl_Position = vec4(pos1,0.0,1.0);
    EmitVertex();
	gl_Position = vec4(pos2,0.0,1.0);
	EmitVertex();
	gl_Position = vec4(pos4,0.0,1.0);
	EmitVertex();
    gl_Position = vec4(pos3,0.0,1.0);
    EmitVertex();
    gl_Position = vec4(pos1,0.0,1.0);
    EmitVertex();
    EndPrimitive();
} 